package com.andooco.dataq.controller;

import com.andooco.dataq.service.cache.CacheService;
import com.andooco.dataq.service.jdbc.JdbcService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 缓存管理
 *
 * @author andooco
 * 20201126
 */
@Slf4j
@Controller
@RequestMapping("/cache")
public class CacheController {
    @Autowired
    private CacheService cacheService;

    /**
     * 刷新程序缓存 andooco 20201126
     *
     * @param model
     * @return
     * @throws Exception
     */
    @RequestMapping("/refreshCache")
    @ResponseBody
    public String refreshCache(Model model) throws Exception {
        log.info("进入方法JdbcController.refreshCache");
        String result = cacheService.refreshCache();
        log.info("缓存刷新结束");
        return result;
    }
}
